﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.IsolatedStorage;
using System.IO;


class IsolatedStorage
{
    static void Main(string[] args)
    {
        DateTime now = DateTime.Now;
        IsolatedStorageFile userStorage = IsolatedStorageFile.GetUserStoreForAssembly();
        using (userStorage)
        {
            IsolatedStorageFileStream stream =
                new IsolatedStorageFileStream("example.txt", FileMode.OpenOrCreate, userStorage);
            using (stream)
            {
                TextReader reader = new StreamReader(stream);
                string lastStartDateTime = reader.ReadToEnd();
                Console.WriteLine("Last start date and time: {0}", lastStartDateTime);

                string newFileContents = now.ToString();
                stream.SetLength(0);
                TextWriter writer = new StreamWriter(stream);
                using (writer)
                {
                    writer.Write(newFileContents);
                }
            }
        }
    }
}
